//
// Created by wze-zero on 2024/7/23 023.
//
#include<iostream>
#include <vector>

using namespace std;

int main() {
    int n, k, num;
    vector<int> a;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> num;
        a.push_back(num);
    }
    vector<int>::iterator iterator = a.end() - 1;
    for (int i = 0; i < k; ++i) {
        cout << *iterator << " ";
        --iterator;
    }
    cout << endl;
    return 0;
}